<?php 
	session_start();
	
	//cek Cookies first.. jika tersimpan cookie login / remember me... maka... langsung ke verify untuk mengecek cookie tersebut benar / tidak
	/* Check if user has been remembered */
	// hashlogin = id. hashremember = pass;
	//cek session jika sudah login, langsung ke verify...
	if( ($_SESSION['reg_login'] == true) && (isset($_SESSION['reg_uname'])) && (isset($_SESSION['reg_level'])) && (isset($_SESSION['reg_jurusan']))){
		/* Redirect to a different page in the current directory that was requested */
		$host  = $_SERVER['HTTP_HOST'];
		$uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
//		$extra = 'verify.php'; //awalnya pngen verify lagi.. coba kyk fb, lngsng login..
		$extra = 'studentpage.php';
		header("Location: http://$host$uri/$extra");
		//if php doesn't work
		?>
			<meta http-equiv="refresh" content="0; url=<?php echo $extra; ?>">
			Klik <a href="<?php echo $extra; ?>">disini</a> apabila browser anda berhenti berjalan ...
		<?php
	}else{
		// jika session ada yg salah / hilang salah 1, maka destroy it !
		session_destroy();
	}
	
	if( (isset($_COOKIE['hashlogin']) && isset($_COOKIE['hashremember'])) ){
		/* Redirect to a different page in the current directory that was requested */
		$host  = $_SERVER['HTTP_HOST'];
		$uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
		$extra = 'verify.php'; //awalnya pngen verify lagi.. coba kyk fb, lngsng login..
		header("Location: http://$host$uri/$extra");
		//if php doesn't work
		?>
			<meta http-equiv="refresh" content="0; url=<?php echo $extra; ?>">
			Klik <a href="<?php echo $extra; ?>">disini</a> apabila browser anda berhenti berjalan ...
		<?php
	}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>KRS Online</title>
<meta name="description" content="KRS Online Universitas Widya Kartika Surabaya">
<meta name="author" content="Rdtz-ICT-Team | www.widyakartika.ac.id">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8" />
<link rel="stylesheet" type="text/css" href="css/reset.css">
<link rel="stylesheet" type="text/css" href="css/structure.css">
</head>

<body>

<div id="wrapper">
	<header id="main">
		<!-- include pengumuman sedikit.. -->
		<marquee style="letter-spacing:1px;marquee-speed:slow;">
		Nilai <strong>UTS</strong> Semester Gasal Periode 2012-2013 sudah keluar *sebagian. 
		Jika anda menemukan Bug / Kritik / Saran, silahkan Laporkan kepada ICT Sesegera mungkin. 
		Terima Kasih.
		</marquee>
		<!-- close here -->
	</header>
	<div class="login logo">
		<a id="logo" href="http://www.widyakartika.ac.id/"></a>
	</div>
	<br />
	<form method="post" class="box login" action="verify.php">
		<fieldset class="boxBody">
		  <label for="username"><strong>Username</strong></label>
		  <input id="username" name="username" type="text" tabindex="1" placeholder="Username / NRP" required>
		  <label for="password">
			<a href="#" class="rLink" tabindex="5"></a>
			<strong>Password</strong>
		  </label>
		  <input id="password" name="password" type="password" tabindex="2" placeholder="Password / PIN" required>
		</fieldset>
		<footer>
		  <label><input id="remember" name="remember" type="checkbox" tabindex="3">Ingat Komputer Saya !</label>
		  <input tabindex="4" type="submit" class="btnLogin" value="Login">
		</footer>
	</form>
	<!--<div class="error">
		<label>Peringatan !</label>
		<span>Username & Password yg anda masukkan salah !</span>
	</div>
	<div class="warning">
		<label>Perjanjian !</label>
		<span>lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum lorim ipsum !</span>
	</div>-->
	<footer id="main">
	  <a href="http://www.widyakartika.ac.id/perpustakaan">Perpustakaan Online</a> | <a href="http://krs.widyakartika.ac.id/">KRS Online</a>
	  <br \>
	  Copyright &copy; 2012. <a href="http://www.widyakartika.ac.id">Universitas Widya Kartika</a> & <a href="#">Labkom ICT</a> - All rights reserved
	  <br \>
	  ver. Virgin.Alpha (<a href="changelog_for_user.txt">Changelog Usr</a> / <a href="changelog.txt">Sys</a>) | Go to Last Update <a href="virgin/alpha-1/">ver. Virgin.Alpha-1</a> / <a href="virgin-2/">Experimental Mode</a>
	</footer>
</div>
</body>
</html>
